public void DitherLine(
byte[] srcBuffer,
int srcBufferOffset,
byte[] destBuffer,
int destBufferOffset
)
- (BOOL)ditherLine:(const unsigned char *)srcBuffer
destBuffer:(unsigned char *)dstBuffer
error:(NSError **)error
public void ditherLine(
byte[] byte[Value,
int intValue,
byte[] byte[Value2,
int intValue2
);
public:
void DitherLine(
array<byte>^ srcBuffer,
int srcBufferOffset,
array<byte>^ destBuffer,
int destBufferOffset
)
def DitherLine(self,srcBuffer,srcBufferOffset,destBuffer,destBufferOffset):
srcBuffer
The input buffer.
srcBufferOffset
Index to srcBuffer where the source data is started.
destBuffer
The output buffer.
destBufferOffset
Index to destBuffer where the destination data is started.
This method uses the dithering method specified in the DitheringMethod property. Therefore, it provides better 4-bit or 8-bit output than the RasterBufferConverter.Convert method.
This method uses the palette that the StartDithering method specifies. The output of the DitherLine method is made up of 1-bit, 4-bit, or 8-bit indexes to the specified palette. StopDithering cleans up the allocated variables and buffers. For a description of how the methods relate to each other, refer to the StartDithering.
This method does not support signed images.
For more information, refer to Introduction to Image Processing With LEADTOOLS.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Core;
using Leadtools.ImageProcessing.Color;
using Leadtools.Dicom;
using Leadtools.Drawing;
using Leadtools.Controls;
using Leadtools.Svg;
public void StartDitheringExample()
{
RasterCodecs codecs = new RasterCodecs();
// Load an image that has BottomLeft ViewPerspective
RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1.CMP"));
RasterColor[] Palette = RasterPalette.Fixed(256);
// Create the new palletized image.
RasterImage destinationImage = new RasterImage(RasterMemoryFlags.Conventional, image.Width, image.Height, 8, image.Order, image.ViewPerspective, Palette, IntPtr.Zero, 0);
// Set the dithering method.
image.DitheringMethod = RasterDitheringMethod.StevensonArce;
// Initialize the dithering process.
image.StartDithering(Palette, 256);
// Allocate the output buffer for 8-bit data.
byte[] InBuffer = new byte[image.Width * 3];// Buffer to hold the input row.
byte[] OutBuffer = new byte[image.Width];// Buffer to hold the output row.
// Use DitherLine method to process each row in the image.
image.Access();
destinationImage.Access();
for (int i = 0; i < image.Height; i++)
{
image.GetRow(i, InBuffer, 0, image.BytesPerLine);
image.DitherLine(InBuffer, 0, OutBuffer, 0);
destinationImage.SetRow(i, OutBuffer, 0, destinationImage.BytesPerLine);
}
destinationImage.Release();
image.Release();
// End the dithering process.
image.StopDithering();
codecs.Save(destinationImage, Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1_DitherLine.BMP"), RasterImageFormat.Bmp, 0);
image.Dispose();
destinationImage.Dispose();
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}
Introduction to Image Processing With LEADTOOLS
Codecs.CodecsThumbnailOptions.DitheringMethod property
ImageProcessing.ColorResolutionCommand.DitheringMethod property
RasterDitheringMethod enumeration
RasterDefaults.DitheringMethod property
RasterImage.DitheringMethod property
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.